import Vue from 'vue'
import VueRouter from 'vue-router'
import NProgress from 'nprogress'
import 'nprogress/nprogress.css'

import { routers }  from './routers'
const RouterConfig = {
    // mode: 'history',
    routes: routers
};

const router = new VueRouter(RouterConfig);




NProgress.configure({ showSpinner: true });

Vue.use(VueRouter)

// 路由跳转前验证
router.beforeEach((to, from, next) => {
    // 开启进度条
    NProgress.start();
    next();
})

router.afterEach(() => {
    NProgress.done(); // 结束Progress
})

export default router